package com.joysuch.wwyt.risk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.risk.bean.RiskControlSearchBean;
import com.joysuch.wwyt.risk.entity.dto.*;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author jingwk
 * @since 2021-05-12
 */
public interface RiskPointMapper extends BaseMapper<RiskPointDto> {

    List<DistrictLevelDto> getLastDistrictPointEvaLevel(@Param("districtIds") Set<Long> districtIds, @Param("pointAnalyzeType") int pointAnalyzeType);

    List<RiskPointEvaluationDto> getLastEvaluationByPointIds(Set<Long> pointIds);

    List<DistrictLevelDto> getFixedDistrictMinPointLevel(Set<Long> districtIds);

    List<DistrictLevelDto> getCtrDistrictMinPointLevel(Set<Long> districtIds);

    IPage<RiskPointDto> getLastEvaluationList(Page<RiskPointDto> page, Long controlLevelId, Integer controlState,
                                              Long responseDepartId, String districtNameOrCode,
                                              List<Long> deptIds, Integer controlRiskLevel, Integer stableRiskLevel, String riskPointName
            , String responseUserName, List<String> executorIds, List<Long> checkJobIds,Integer troubleshootingType);

    long getLastEvaluationListCount(Long controlLevelId, Integer controlState,
                                    Long responseDepartId, String districtNameOrCode,
                                    List<Long> deptIds, Integer controlRiskLevel, Integer stableRiskLevel, String riskPointName
            , String responseUserName,List<String> executorIds, List<Long> checkJobIds,Integer troubleshootingType);

    List<RiskPointEvaluationDto> getLastEvaluationByPointIdsAndPointAnalyzeType(@Param("pointIdList") Set<Long> pointIdList, @Param("pointAnalyzeType") Integer pointAnalyzeType);

    List<RiskPointControlDto> getRiskPointControlPage(Page<RiskPointControlDto> page,
                                                      RiskControlSearchBean searchBean,
                                                      Long riskPointId,
                                                      List<String> userIds, List<Long> checkJobIds);

    Integer getRiskPointControlCount(RiskControlSearchBean searchBean, Long riskPointId, List<String> userIds, List<Long> checkJobIds);

    List<EvaluationDateDto> getAllLastEvaluationIdByriskDistrictId(@org.apache.ibatis.annotations.Param("riskDistrictId") Long riskDistrictId);

    List<RiskPointControlDto> getRiskControlChecklistForScreenPage(Page<RiskPointControlDto> page, List<Long> evaluationIdList,Long tenentId, String orgCode);

    Integer getRiskControlChecklistForScreenCount(List<Long> evaluationIdList,Long tenentId, String orgCode);

    List<RiskEvaluationPlanDetailDto> getAllPlanDetail(Long tenentId, String orgCode);

    String getNameById(Long riskPointId);

}
